{literal}
<script language="javascript">
<!--
    iLastId = 1;

    function addOption()
    {
        oNewOptionField = document.getElementById('new_option');
        if (oNewOptionField.value == '')
        {
        	{/literal}
            alert('{language text='Mod_Account.specify_new_option'}');
            {literal}
            oNewOptionField.focus();
            return false;
        }
        oTable = document.getElementById('options_table');
        iIndex = oTable.rows.length - 3;
        oRow = oTable.insertRow(iIndex);
        oRow.setAttribute('id', iLastId);

        oTd = oRow.insertCell(0);
        oTd.className = 'row1';
        oInputElement = document.createElement('input');
        oInputElement.setAttribute('type', 'radio');
        oInputElement.setAttribute('name', 'default');
        oInputElement.setAttribute('value', 'new' + iLastId);
        oTd.appendChild(oInputElement);

        oTd = oRow.insertCell(1);
        oTd.className = 'row1';
        oInputElement = document.createElement('input');
        oInputElement.setAttribute('type', 'text');
        oInputElement.setAttribute('name', 'option[new' + iLastId + ']');
        oInputElement.setAttribute('value', oNewOptionField.value);
        oTd.appendChild(oInputElement);

        oTd = oRow.insertCell(2);
        oTd.className = 'row1';
        {/literal}
        oTd.innerHTML = '<a href="#" onclick="return deleteOption(' + iLastId + ')">{language text="delete_383"}</a>';
		{literal}
        iLastId++;
        oNewOptionField.value = '';
        oNewOptionField.focus();
        return true;
    }

    function deleteOption(iId)
    {
        if (!sure(''))
        {
            return false;
        }
        oTable = document.getElementById('options_table');
        oRow = document.getElementById(iId);
        oTable.deleteRow(oRow.rowIndex);
        return false;
    }

    function deleteOldOption(iOptionId)
    {
        if (!sure(''))
        {
            return false;
        }
        oForm = document.getElementById('option_form');
        oNewHidden = document.createElement('input');
        oNewHidden.setAttribute('type', 'hidden');
        oNewHidden.setAttribute('name', 'delete[]');
        oNewHidden.setAttribute('value', iOptionId);
        oForm.appendChild(oNewHidden);
        oTable = document.getElementById('options_table');
        oTr = document.getElementById('old' + iOptionId);
        oTable.deleteRow(oTr.rowIndex);
        return false;
    }
-->
</script>
{/literal}
{messages}
<form id="option_form" action="{url link='admin.main.custom-fields-option' id=$iFieldId}" method="post">
<table cellspacing="0" width="100%" class="forumline" id="options_table">
    <tr>
        <td class="row-header" colspan="3"><span>{language text="profile_fields_dropdowns"}</span></td>
    </tr>
    <tr>
        <th style="width:5%;font-size:9pt;">
            <span>{language text="default_492"}</span>
        </th>
        <th style="width:20%;font-size:9pt;">
            <span>{language text="option"}</span>
        </th>
        <th style="width:20%;text-align:center;font-size:9pt;">
            <span>&nbsp;</span>
        </th>
    </tr>
{foreach from=$aItems item=aItem name=aitems key=iKey}
    <tr id="old{$aItem.custom_option_id}">
        <td style="width:5%;font-size:9pt;" class="row1" align="center">
            <input type="radio" name="default" value="{$aItem.custom_option_id}"{if $aItem.custom_option_is_default} checked="checked"{/if} />
        </td>
        <td style="width:20%;font-size:9pt;" class="row1">
            <input type="text" name="option[{$aItem.custom_option_id}]" value="{$aItem.custom_option_name|escape}" />
        </td>
        <td style="width:20%;font-size:9pt;" class="row1">
            {if !$aItem.custom_option_is_default}<a href="{url link='current' idelete=$aItem.custom_option_id}">{language text="delete_383"}</a> | {/if}
            <a href="{url link='admin.language.add-phrase' translate=$aItem.custom_option_name|base64}">{language text='Mod_Language.translate'}</a>
        </td>
    </tr>
{foreachelse}
    <tr>
        <td colspan="3" align="center"><div class="message_info">{language text="there_are_no_custom_field"}</div></td>
    </tr>
{/foreach}
    <tr>
        <td style="width:5%; font-size:9pt; text-align:right;" class="row1">
			{language text="add_new_option"}:
        </td>
        <td style="width:20%;font-size:9pt;" class="row1">
            <input type="text" id="new_option" name="option[new_field]" value="" />
        </td>
        <td style="width:20%;text-align:left;font-size:9pt;" class="row1">
            <input type="button" value="{language text="add"}" onclick="addOption();" />
        </td>
    </tr>
    <tr>
        <td colspan="3" align="left" style="padding:5px; text-align:center;" class="catBottom">
            <input type="submit" name="act[save]" value="{language text="save"}" />
        </td>
    </tr>
</table>
</form>